﻿<%@ Page Title="Edit Club" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="EditClub.aspx.vb" Inherits="WSAD_Assignment.EditClub" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">

<h3 class="form-signup-heading">Edit Club: <asp:Label ID="lblClub" runat="server"></asp:Label></h3>

   <div class="form-group">
        <asp:Label ID="lblClubName" AssociatedControlID="txtClubName" runat="server" CssClass="col-sm-2 control-label" Text="Name"></asp:Label>

   		<div class="col-sm-4">
            <asp:TextBox ID="txtClubName" name="txtClubName" runat="server" CssClass="form-control" placeholder="Name"></asp:TextBox>
            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtClubName" Display="Dynamic" CssClass="field-validation-error" ErrorMessage="This is a required field!" />
            <asp:RegularExpressionValidator runat="server" ControlToValidate="txtClubName" Display="Dynamic" ErrorMessage="This field must be between 5 and 30 characters long!"
                    CssClass="field-validation-error" ValidationExpression="^[a-zA-Z0-9'@&#.,\s]{5,30}$" />
   		</div>
   </div>

   <div class="form-group">
        <asp:Label ID="lblFoundationDate" AssociatedControlID="txtFoundationDate" runat="server" CssClass="col-sm-2 control-label" Text="Foundation Date"></asp:Label>

   		<div class="col-sm-2">
            <asp:TextBox ID="txtFoundationDate" name="txtFoundationDate" runat="server" CssClass="form-control" placeholder="Foundation Date"></asp:TextBox>
            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtFoundationDate" Display="Dynamic" CssClass="field-validation-error" ErrorMessage="This is a required field!" />
            <asp:RegularExpressionValidator runat="server" ControlToValidate="txtFoundationDate" Display="Dynamic" ErrorMessage="Please enter a valid date!"
                    CssClass="field-validation-error" ValidationExpression="^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$" />
   		</div>
   </div>

   <script type="text/javascript">
       var dp_now = new Date();

       $( "#<%= txtFoundationDate.ClientID %>" ).datepicker({
            dateFormat: 'dd/mm/yy',
            minDate: "01/01/1500",
            maxDate: dp_now
        })
   </script>

   <div class="form-group">
        <asp:Label ID="lblClubAddress" AssociatedControlID="txtClubAddress" runat="server" CssClass="col-sm-2 control-label" Text="Address"></asp:Label>

   		<div class="col-sm-5">
            <asp:TextBox ID="txtClubAddress" name="txtClubAddress" runat="server" CssClass="form-control" placeholder="Address"></asp:TextBox>
            <asp:RequiredFieldValidator runat="server" ControlToValidate="txtClubAddress" Display="Dynamic" CssClass="field-validation-error" ErrorMessage="This is a required field!" />
            <asp:RegularExpressionValidator runat="server" ControlToValidate="txtClubAddress" Display="Dynamic" ErrorMessage="This field must be between 5 and 100 characters long!"
                    CssClass="field-validation-error" ValidationExpression="^[a-zA-Z0-9'@&#.,\s]{5,100}$" />
   		</div>
   </div>

   <div class="form-group">
        <asp:Label ID="lblCountry" AssociatedControlID="ddlCountry" runat="server" CssClass="col-sm-2 control-label" Text="Country"></asp:Label>

   		<div class="col-sm-3">
            <asp:DropDownList ID="ddlCountry" name="ddlCountry" runat="server" DataSourceID="CountriesDataSource" DataTextField="CountryName" DataValueField="ID" CssClass="form-control">
            </asp:DropDownList>
            <asp:SqlDataSource ID="CountriesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ClubsConnectionString %>" ProviderName="<%$ ConnectionStrings:ClubsConnectionString.ProviderName %>" SelectCommand="SELECT [CountryName], [ID] FROM [Countries]"></asp:SqlDataSource>
   		</div>
   </div>

   <div class="form-group">
        <asp:Label ID="lblEmblem" AssociatedControlID="fuEmblem" runat="server" CssClass="col-sm-2 control-label" Text="Emblem"></asp:Label>

   		<div class="col-sm-5">
            <asp:FileUpload ID="fuEmblem" name="fuEmblem" runat="server" />
   		</div>
   </div>

    <div class="form-group">
        <asp:LinkButton ID="btnSaveChanges" 
                runat="server"
                CssClass="btn btn-success"    
                OnClick="btnSaveChanges_Click"
                CausesValidation="True">
                <i aria-hidden="true" class="glyphicon glyphicon-floppy-disk"></i> Save Changes
        </asp:LinkButton>

        <asp:LinkButton ID="btnBackClub" 
                runat="server"
                CssClass="btn btn-default cancel"    
                CausesValidation="False"
                OnClick="btnBackClub_Click">
                <i aria-hidden="true" class="glyphicon glyphicon-arrow-left"></i> Back to Club
        </asp:LinkButton>
    </div>

</asp:Content>
